Use rem to achieve adaptive Advantages and Disadvantages Analysis and rem adaptive advantages and disadvantages
There are still a lot of discussions about implementing the screen Adaptive Layout of rem. I also saw the use of rem to implement the adaptive web app, so I also came to the discussion.
Speaking of
Use rem to develop your mobile website and rem Development
What is rem?
1) The unit of measurement element size in css3, such as px, pt, and em.
2) A calculation method of the font-size relative to the root element. 1rem =
3) Use Cases: the width and height of each element, text size, line spacing, padding, and other places where the length unit can be used.
4)
About the pc-side rem font settings ., Pc-side rem font settings
1. the content displayed on the screen is in the upper-right corner (content box). The content is definitely located in the content box. in this way, the content is always in the middle of the screen of different sizes and looks normal.
2. long, wide, LEFT, TOP, RIGHT, and BOTTOM all adopt REM, And
Rem achieves adaptive initial experience and rem adaptive initial experience
For the first time, I encountered the first problem when I made a mobile page, that is, the carousel image of the Mobile End. In fact, there are many plug-ins for carousel images, but they are not easy to find if they fully meet the requirements.
Requirements:
1. Achieve Basic touch screen carousel Effects
2. The image with a non-s
Rem explanation and usage, rem explanation and usage
It seems that I haven't written a blog for a while ...... Today, I just summarized the usage of rem.
First, let's talk about common sense,The default font height of the browser is 16 PX.. Step into the topic -----> -----〉
Compatibility:
Currently, mainstream versions of IE9 +, Firefox, Chrome, Safari, and Op
After reading some rem knowledge points, I will make a self-Summary here, and summarize the rem knowledge points.
The most common font units are PX and EM.
First, px:
Pixel (Pixel ). The unit of relative length. Pixel px is relative to the screen resolution of the monitor. (Derived from the CSS2.0 manual)
Px changes with the screen resolution, but the overall layout of the page is affected when the browser
Mobile Terminal rem layout and terminal rem Layout
It is understood that there are now two types of rem layout style control, one is through css media queries, and the other is through the introduction of js to control, these two methods have their own differences, but I still like to use the js method to implement rem
Mobile web development: rem responsive design and web development rem response
I use sass to write css as follows:
1. variable. scss
Define a variable $ base_fontSize in the variable. scss file to set the basic font size (I am using the percentage, that is, multiply the percentage by the default browser font value ).
//font-size$base_fontSize:62.5%;
2. base. scss
In base. introduce the above variable file i
Mobile Terminal conversion rem adaptation, conversion rem adaptation
For more information, see the code:
The above is all the content of this article. I hope this article will help you in your study or work. I also hope to provide more support to the customer's home!
Article Introduction: CSS3 has added a relative unit of REM (root em, root em), a unit that has aroused widespread concern. What is the difference between this unit and EM? The difference is that when you use REM to set the font size for an element, it is still relative in size, but only relative to the HTML root element.
CSS3 has added a relative unit of RE
Do a PC-side web page, the design is 1920x1080. To display normal on a common screen (proportional to correct) 1280x720 1366x768 1440x900 1920x1080Several methods have been used1. Content in a screen display, the use of (content box) up and down around the center of the method, the content is absolutely in this content box positioning. In this way, the content is always in the middle and looks more normal in different size screens.2. Long, wide, left,top,right,bottom are used
1. Why use REM
Blog for a long time did not write, the reason is very simple.
Recently took over a project, to do at the same time PC and mobile end of the page, has not been contacted before, but after all, the money is the big ye, so still bite the bullet.
The most troublesome thing is what to move the end.
different resolution fit.
Specifically, some screen 320px wide, some screen 640px wide, and some more wide, if you write fixed px, then either
first, about the unit in CSSWe all know that the units in the CSS, generally include px,%,em and other units, in addition CSS3 a new unit of REM.px,% and other units usually in the traditional layout of the use of more frequent, we are more familiar with, but PX units in the process of self-adaptive layout will be somewhat inadequate, most of the solution is to use the percentage of units with @media Media query for adaptive layout.But there's another CSS3. Newly added units can also be used for
There are now 5 different schemes for the adaptive layout of mobile web apps. 0. Flexbox The use of CSS3 Flexbox for layout, support for rich media and complex typography is very strong, not universal compatibility is very poor, almost no project to be applied. I. Flexible layout Relative layout with EM or REM units makes the relative percent more flexible, while supporting the normal display of browser font resizing and scaling. Because EM is relativ
The length unit mainly has the following kinds of EM ex ch REM VW VH vm cm mm in pt pc px%, presumably can be divided into several "absolute units" and "relative units" and "percent units".
Absolute unit: px in cm mm
Relative unit: EM rem pt PC EX CH
Percent unit: VW VH VM%
The following mainly say a few commonly used units
PX: Absolute Unit, page by ex
Now Universal mobile development is using REM for development, but using REM development has a pain, that is, when you write CSS, you need to transform the PX into REM, so today we introduce a SUBLIMETEXT3 automatic conversion of PX to REM plug-in-cssrem.The first plug-in effect chart:
This can be relieved by the PX
Recently in the project, in order to respond to the operation, with the emergence of a new unit--rem, in the mainstream browser is no problem. But there is a supernatural bug in IE.
Bug statement: When the page is loaded, all elements of the page are not displayed according to the REM value computed by the corresponding JS obtained. However, when the mouse hovers over the corresponding element, it will sho
declarations of font size.
That is to avoid the 1.2 * 1.2 = 1.44 phenomenon. For example, if you declare a font size of 1.2em in #content, then you can only 1em when declaring P's font size, not 1.2em, because this em is not the other em, and it becomes 1em=12px because it continues to #content the font height.
But the exception of 12px Chinese characters is that the 12px (1.2em) size of Chinese characters obtained by the above method is not equal to the font size defined directly with 12px,
a question in a command without human input
ECHO ^g: "^g" is a ctrl+g type of conjoined symbols, input multiple ^g can produce multiple beeps.
Second, pause command: Line This sentence will be suspended
The @ command: echo off image, but it is added to the front of the other command line, indicating that the runtime does not display the command line itself.
Four, call order
Call invokes another batch file (if another batch file is called directly, the current file successor command cannot be
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.